//
//  ButtonView.m
//  TravelYo
//
//  Created by lanou3g on 15/10/29.
//  Copyright © 2015年 TravelYo. All rights reserved.
//

#import "ButtonView.h"

@interface ButtonView ()

@property (nonatomic, assign) CGFloat selfWidth;
@property (nonatomic, assign) CGFloat selfHeight;

@end




@implementation ButtonView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _selfWidth = frame.size.width;
        _selfHeight = frame.size.height;
        [self addSubView];
        
    }
    return self;
}

- (void)addSubView
{
    NSArray *array = @[@"最新",@"攻略", @"结伴"];
    for (int i = 0; i < 3; i++) {
        UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
        [button setTitle:array[i] forState:(UIControlStateNormal)];
        button.frame = CGRectMake((_selfWidth / 3) * i, 0, _selfWidth / 3, _selfHeight - 5);
        button.tag = 1000 + i;
        [button setBackgroundImage:[UIImage imageNamed:@"buttonbackG1.png"] forState:(UIControlStateNormal)];
        [button setTitleColor:[UIColor grayColor] forState:(UIControlStateNormal)];
        
        [self addSubview:button];
    }
    
    _zuiXinButton = (UIButton *)[self viewWithTag:1000];
    _gongLvButton = (UIButton *)[self viewWithTag:1001];
    _togetherButton = (UIButton *)[self viewWithTag:1002];
   
}







@end
